package com.huike.web.controller.clues;

import com.huike.clues.mapper.MpClueMapper;
import com.huike.clues.service.CluesRecordService;
import com.huike.common.core.domain.AjaxResult;
import com.huike.common.entity.MPTbClueTrackRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description TODO
 * @Author hxd
 * @Date 2023-08-30 12:04
 */
@Slf4j
@RestController
@Api(tags = "线索跟进记录管理相关接口")
@RequestMapping("/clues")
public class CluesRecordController {

    @Resource
    private CluesRecordService cluesRecordService;

    /**
     * 新增线索跟进记录
     * @param mpTbClueTrackRecord
     * @return
     */
    @PostMapping("/record")
    @ApiOperation("新增线索跟进记录")
    public AjaxResult add(@RequestBody MPTbClueTrackRecord mpTbClueTrackRecord){
        cluesRecordService.add(mpTbClueTrackRecord);
        return AjaxResult.success();
    }

    /**
     * 查询线索跟进记录列表
     * @param clueId
     * @return
     */
    @GetMapping("/record/list")
    @ApiOperation("查询线索跟进记录列表")
    public AjaxResult recordList(Long clueId){
        MPTbClueTrackRecord mpTbClueTrackRecord = cluesRecordService.recordList(clueId);
        return AjaxResult.success(mpTbClueTrackRecord);
    }


    /**
     * 获取线索跟进记录详细信息
     * @param id
     * @return
     */
    @GetMapping("/clue/{id}")
    @ApiOperation("获取线索跟进记录详细信息")
    public AjaxResult<MPTbClueTrackRecord> findId(@PathVariable Long id){
        MPTbClueTrackRecord mpTbClueTrackRecord = cluesRecordService.findId(id);
        return AjaxResult.success(mpTbClueTrackRecord);
    }
}
